import { WindowComp } from '@/components'
import { FC } from 'react'
import Content from './Content'
import styles from './styles.module.less'
import { ScanQRcodePropsType } from './types'
import { sizeTypes } from './cons'
import { getClassNames } from 'magic-ui-react'

const ScanQRcode: FC<ScanQRcodePropsType> = (props) => {
  const {
    sizeType,
    isClick = true
  } = props

  const icon = (
    <>
      <main
        className={getClassNames([
          styles.ScanQRcode,
        ])}
        onClick={(e) => {
          if (!isClick) {
            e.stopPropagation()
          }
        }}
      >
        {sizeTypes[sizeType]}
      </main>
    </>

  )

  return (
    <WindowComp
      title="扫码"
      width={500}
      icon={() => icon}
      content={<Content />}
    />
  )
}
export default ScanQRcode